package com.mes.cloud.quartz;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * @Description 抽象类
 * @author: wxm
 * @date: 2019/6/11 15:32
 * @version: 1.0
 */
public abstract class AbsJob implements Job {
	/**
	 * 日志记录
	 */
	private static final Logger LOGGER = LoggerFactory.getLogger(AbsJob.class);
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		String name = this.getClass().getName();
		LOGGER.info("Job Start:" + name);

		try {
			// 业务处理
			process(context);
		} catch (Exception e) {
			LOGGER.info("业务执行异常：", e);
		}

		LOGGER.info("Job End:" + name);
	}

	/**
	 * 业务处理
	 * 
	 * @param context JOB上下文
	 */
	protected abstract void process(JobExecutionContext context);
}
